#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
#   http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#
AUTOMAKE_OPTIONS = subdir-objects serial-tests

THRIFT_LIB_DIR = /home/work/usr/lib
BUILT_SOURCES = \
	gen-c_glib/dmm.h \
	gen-c_glib/idms_types.h

AM_CFLAGS = -g -Wall -Wextra -pedantic $(GLIB_CFLAGS) $(GOBJECT_CFLAGS) @GCOV_CFLAGS@
AM_CPPFLAGS = -I$(top_srcdir)/lib/c_glib/src -Igen-c_glib
AM_LDFLAGS = $(GLIB_LIBS) $(GOBJECT_LIBS) @GCOV_LDFLAGS@

THRIFT = thrift

noinst_LTLIBRARIES = \
	libidmsgencglib.la

nodist_libidmsgencglib_la_SOURCES = \
	gen-c_glib/dmm.c \
	gen-c_glib/dmm.h \
	gen-c_glib/idms_types.c \
	gen-c_glib/idms_types.h

libidmsgencglib_la_LIBADD = \
	$(THRIFT_LIB_DIR)/libthrift_c_glib.la

libidmsgencglib_la_CFLAGS = \
	$(AM_CFLAGS) -Wno-unused-function

noinst_PROGRAMS = \
	idms_server \
	idms_client

idms_server_SOURCES = \
	c_glib__idms_server.c

idms_server_LDADD = \
	libidmsgencglib.la \
	$(THRIFT_LIB_DIR)/libthrift_c_glib.la

idms_client_SOURCES = \
	c_glib__idms_client.c

idms_client_LDADD = \
	libidmsgencglib.la \
	$(THRIFT_LIB_DIR)/libthrift_c_glib.la


gen-c_glib/dmm.c gen-c_glib/dmm.h gen-c_glib/idms_types.c gen-c_glib/idms_types.h: $(top_srcdir)/test/idms/idms.thrift
	$(THRIFT) --gen c_glib -r $<

clean-local:
	$(RM) gen-c_glib/*

idmsserver: all
	./idms_server

idmsclient: all
	./idms_client

EXTRA_DIST = \
	c_glib__idms_server.c \
	c_glib__idms_client.c
